package com.example.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CrowdWebMvcConfig implements WebMvcConfigurer {


    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // 前端请求的url地址
        String urlPath = "/auth/to/member/reg/page.html";

        // 实际后端跳转页面（会自动拼上前后缀）
        String viewName = "reg";

        // 前往用户注册页面
        registry.addViewController(urlPath).setViewName(viewName);

        // 前往登录页面
        registry.addViewController("/auth/to/member/login/page.html").setViewName("login");

        // 前往登录完成后的用户主页面
        registry.addViewController("/auth/to/member/center/page.html").setViewName("member-center");
        // 前往“我的众筹”页面
        registry.addViewController("/auth/to/member/crowd/page.html").setViewName("member-crowd");
//        registry.addViewController("/project/agree/protocol/page.html").setViewName("member-crowd");


        registry.addViewController("/do/crowd/launch/page.html").setViewName("use/project-launch");
        registry.addViewController("/agree/protocol/page.html").setViewName("use/project-agree");
        registry.addViewController("/return/info/page.html").setViewName("use/project-return");
        registry.addViewController("/create/confirm/page.html").setViewName("use/project-confirm");
        registry.addViewController("/create/success.html").setViewName("use/project-success");

        registry.addViewController("admin/main/add.html").setViewName("admin/admin-add");
        registry.addViewController("/role/to/page.html").setViewName("admin/role-page");
        registry.addViewController("/menu/to/page.html").setViewName("admin/menu-page");


    }
}
